/**
 * 
 */
package com.ubo.java.model.declaration;

import java.util.List;


import com.ubo.java.model.EModifier;
import com.ubo.java.model.EVisibility;
import com.ubo.java.model.IType;
import com.ubo.java.model.comment.Comment;
import com.ubo.transform.java.IJavaVisitor;

/**
 * @author saludegu
 * 
 */
public class Attribut extends ADeclaration {

	/**
	 * Visibilité de la variable.
	 */
	protected final EVisibility mVisibility;

	/**
	 * Valeur de la variable.
	 */
	protected IType mValue;

	/**
	 * Commentaire de l'attribut.
	 */
	protected final Comment mComment;

	/**
	 * 
	 * Constructor
	 * 
	 * @param variableName
	 * @param type
	 * @param modifiers
	 * @param visibility
	 * @param value
	 */
	public Attribut(String variableName, IType type, List<EModifier> modifiers,
			EVisibility visibility) {
		super(variableName, type, modifiers);
		mVisibility = visibility;
		mComment = new Comment(new StringBuffer("\t*\n\t* " + variableName
				+ "\n\t"));
	}

	/**
	 * 
	 * Constructor
	 * 
	 * @param variableName
	 * @param type
	 * @param modifiers
	 * @param visibility
	 * @param value
	 */
	public Attribut(String variableName, IType type, List<EModifier> modifiers,
			EVisibility visibility, IType value) {
		super(variableName, type, modifiers);
		mVisibility = visibility;
		mValue = value;
		mComment = new Comment(new StringBuffer("\n\t*\n\t* " + variableName));
	}

	/**
	 * Getter du commentaire de l'attribut.
	 * 
	 * @return
	 */
	public Comment getComment() {
		return mComment;
	}

	/**
	 * @return the mValue
	 */
	public IType getValue() {
		return mValue;
	}

	/**
	 * @param mValue
	 *            the mValue to set
	 */
	public void setValue(IType mValue) {
		this.mValue = mValue;
	}

	/**
	 * @return the mVisibility
	 */
	public EVisibility getVisibility() {
		return mVisibility;
	}

	/**
	 * @see com.ubo.transform.java.IJavaGenerable#generate(com.ubo.transform.java.IJavaVisitor)
	 */
	@Override
	public void generate(IJavaVisitor<?> generator) {
		generator.generate(this);
	}
}
